package 蓝桥真题;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class 购物单 {
       static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       
	   public static void main(String[]args)throws Exception{
		      String item="";
		      System.out.println(br.readLine());
		      System.out.println("算法");
		      double res=0;
		      while(!(item=br.readLine()).equals("0")){
		    	    item=item.replaceAll(" ","");
		    	    System.out.println(item);
		    	    int idx=item.indexOf('.')+2;
		    	    double price=Double.parseDouble(item.substring(4, idx+1));
		    	    String t=item.substring(idx+1,item.length()-1);
		    	    double discount=0;
		    	    if(t.equals("半"))discount=0.5;
		    	    else discount=Double.parseDouble(t);
		    	    res+=price*discount;
		      }
		      System.out.print(res);
	   }
}
